package com.aabte.design.pattern.creational.prototype.clone;

import java.time.Clock;
import java.util.Date;

public class PigTest {

    public static void main(String[] args) throws CloneNotSupportedException {

        Date birthday = new Date(0L);
        Pig pig1 = new Pig("佩奇", birthday);
        Pig pig2 = (Pig)pig1.clone();

        System.out.println(pig1);
        System.out.println(pig2);

        birthday.setTime(Clock.systemDefaultZone().millis());

        System.out.println(pig1);
        System.out.println(pig2);
    }

}
